package com.sk.weichat.adapter;

import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sk.weichat.R;
import com.sk.weichat.bean.SubjectItemBean;

import java.util.List;

/**
 * @Author: chenzl
 * @ClassName: SubjectItemAdapter
 * @Description: 话题 适配器
 * @CreateDate: 2019/10/24 18:06
 */
public class SubjectItemAdapter extends BaseQuickAdapter<SubjectItemBean,BaseViewHolder> {

    public SubjectItemAdapter(@Nullable List<SubjectItemBean> data) {
        super(R.layout.layout_subject_item, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SubjectItemBean item) {
        helper.addOnClickListener(R.id.tv_subject);
        TextView tv_subject = helper.getView(R.id.tv_subject);
        tv_subject.setText(mContext.getString(R.string.subject,item.getTopicName()));
        if (item.isSelect()){
            tv_subject.setBackgroundResource(R.drawable.shape_corner_26dp_solid_eeebff);
            tv_subject.setTextColor(helper.itemView.getResources().getColor(R.color.color_8873FE));
        }else {
            tv_subject.setBackgroundResource(R.drawable.shape_corner_26dp_solid_edeff2);
            tv_subject.setTextColor(helper.itemView.getResources().getColor(R.color.color_8C8C8C));
        }
    }
}
